package com.server.server_a10.entity;

import org.springframework.format.annotation.DateTimeFormat;

import javax.xml.crypto.Data;
import java.util.Date;

/**
 * 消息，接口返回参数
 */

@lombok.Data
public class Inform {
    private int code;
    private Object data;
    private String msg;
    private Date time;

    public Inform(){
        this.time = new Date();
    }
    public Inform(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Inform(int code, Object data, String msg, Date time) {
        this.code = code;
        this.data = data;
        this.msg = msg;
        this.time = time;
    }

    public boolean success(String msg,Object data){
        this.code = 200;
        this.msg = msg;
        this.data = data;

        return true;
    }
    public boolean isNull(String msg){
        this.code = 100;
        this.msg = msg;

        return true;
    }
    public boolean fail(String msg,Object data){
        this.code = 101;
        this.msg = msg;
        this.data = data;

        return true;
    }

}